﻿using System;
using System.Web.Optimization;

namespace ZSoft.Telegram.UI.Web
{
    public class BundleConfig
    {
        public static void AddDefaultIgnorePatterns(IgnoreList ignoreList)
        {
            if (ignoreList == null)
                throw new ArgumentNullException("ignoreList");


            ignoreList.Ignore("*.intellisense.js");
            ignoreList.Ignore("*-vsdoc.js");
            ignoreList.Ignore("*.debug.js", OptimizationMode.WhenEnabled);
            ignoreList.Ignore("*.min.css", OptimizationMode.WhenDisabled);
        }

        public static void RegisterBundles(BundleCollection bundles)
        {
            BundleTable.EnableOptimizations = true;
            bundles.Add(FileUploadBundle());
        }
        
        public static ScriptBundle FileUploadBundle()
        {
            ScriptBundle result = new ScriptBundle("~/bundles/fileUpload");

            result.Include(
                "~/Content/assets/plugins/jquery-file-upload/js/vendor/jquery.ui.widget.js",
                "~/Content/assets/plugins/jquery-file-upload/js/vendor/tmpl.min.js",
                "~/Content/assets/plugins/jquery-file-upload/js/vendor/load-image.min.js",
                "~/Content/assets/plugins/jquery-file-upload/js/vendor/canvas-to-blob.min.js",
                "~/Content/assets/plugins/jquery-file-upload/js/jquery.iframe-transport.js",
                "~/Content/assets/plugins/jquery-file-upload/js/jquery.fileupload.js",
                "~/Content/assets/plugins/jquery-file-upload/js/jquery.fileupload-process.js",
                "~/Content/assets/plugins/jquery-file-upload/js/jquery.fileupload-image.js",
                "~/Content/assets/plugins/jquery-file-upload/js/jquery.fileupload-audio.js",
                "~/Content/assets/plugins/jquery-file-upload/js/jquery.fileupload-video.js",
                "~/Content/assets/plugins/jquery-file-upload/js/jquery.fileupload-validate.js",
                "~/Content/assets/plugins/jquery-file-upload/js/jquery.fileupload-ui.js");

            return result;
        }
    }
}
